//
//  JWRealmManager.h
//  SiqiCalendar
//
//  Created by sunjiawen on 2018/4/2.
//  Copyright © 2018年 sjw. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Realm/Realm.h>

@class JWCalendarModel;
@class JWScheduleModel;
@class JWAlarmClockModel;

@interface JWRealmManager : NSObject
/** 单例 */
+ (instancetype)defaultManager;

#pragma mark - 日历 JWCalendarModel
- (NSInteger)numberOfCalendars;

- (void)insertWithJWCalendarModel:(JWCalendarModel *)calendarModel;

- (void)addOrUpdateWithJWCalendarModel:(JWCalendarModel *)calendarModel;

- (RLMResults *)queryAllCalendar;

- (JWCalendarModel *)queryCalendarWithCalendarId:(NSString *)calendarId;

- (JWCalendarModel *)queryCalendarDefault;

- (void)deleteCalendarWithCalendarId:(NSString *)calendarId;

- (void)updateAllCalendarOrderIndex:(NSArray *)calendars;

#pragma mark - 班名 JWScheduleModel
- (void)insertWithScheduleModel:(JWScheduleModel *)scheduleModel;

- (RLMResults *)queryAllSchedules ;

- (void)updateAllSchedulesOrderIndex:(NSArray *)schedules;

- (NSInteger)numberOfSchedule;

#pragma mark - 闹钟 JWAlarmClockModel
- (void)insertWithAlarmClock:(JWAlarmClockModel *)alarmModel;

- (RLMResults *)queryAllAlarmClock;

- (JWAlarmClockModel *)queryAlarmClockWithAlarmID:(NSString *)alarmID;

- (void)deleteAlarmClockWithAlarmID:(NSString *)alarmID;

@end
